
from django.contrib.auth.models import Group, Permission
from rest_framework import serializers


class GroupPermSimpleSerializer(serializers.ModelSerializer):
    class Meta:
        model = Permission
        fields = [
            'id',
            'name'
        ]


class GroupModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = Group
        fields = [
            'id',
            'name',
            #假设模型类序列化器可以完成该字段的校验和新建中间表数据
            'permissions'
        ]